import java.util.ArrayList;

import agent.AreaRotas;
import jade.core.Profile;
import jade.core.ProfileImpl;
import jade.tools.sniffer.ExitAction;
import jade.wrapper.AgentController;
import jade.wrapper.ContainerController;
import jade.wrapper.StaleProxyException;
import model.Coordenada;
import model.Rota;


public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		
		ArrayList<Rota> rotas = new ArrayList<Rota>();
		AreaRotas.setRotas(rotas);
		Coordenada origem = new Coordenada(-23.545045, -46.648636);
		Coordenada destino = new Coordenada(-23.517074, -46.533279);
		Object[] argumentos = new Object[2];
		argumentos[0] = origem;
		argumentos[1] = destino;
		// TODO Auto-generated method stub

		AgentController agent1;
		AgentController agent2;
		jade.core.Runtime runtime = jade.core.Runtime.instance();
		Profile perfilMain = new ProfileImpl();
		ContainerController mainContainer = runtime.createMainContainer(perfilMain);
		
		try{
			agent1 = mainContainer.createNewAgent("Coordenador", "agent.AgCoordenador", argumentos);
			agent1.start();
			agent2 = mainContainer.createNewAgent("Buscador", "agent.AgBuscador", null);
			agent2.start();
//			do{
//				if(AreaRotas.getNumRotas() != 0){
//					System.out.println("Numero de rotas: "+AreaRotas.getNumRotas());
//				}
//			}while(AreaRotas.getNumRotas() < 2);
//			

			//agent1.kill();
//			agent2.kill();
			//main.kill();
			//runtime.shutDown();
			
			
		}catch(StaleProxyException e){
			e.printStackTrace();
		}
		
		
	}

}
